package com.study.yangfei.mystudy.activity;

import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.study.yangfei.mystudy.R;

public class DBActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_db);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        createDB();
    }

    public void createDB(){
        SQLiteDatabase db = SQLiteDatabase.create(null);
        db.execSQL("CREATE TABLE cheese(name TEXT,origin TEXT)");
        db.execSQL("INSERT INTO cheese VALUES ('Roquefort','Roquefort-sur-Soulzon')");
        db.close();
    }

}
